package com.swyc.osschat.Common.Base;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.swyc.osschat.Chat.Dao.MessageInfoDao;
import com.swyc.osschat.Chat.Dao.RecentChatDao;
import com.swyc.osschat.Common.Util.Page.PageUtils;
import com.swyc.osschat.Common.Util.Page.Query;
import com.swyc.osschat.Jurisdiction.Dao.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

public class BaseServiceImpl<M extends BaseDao<T>,T extends BaseRelationEntity> extends ServiceImpl<M,T> implements BaseService<T>{
    @Autowired
    protected MessageInfoDao messageInfoDao;
    @Autowired
    protected RecentChatDao recentChatDao;
    @Autowired
    protected MenuDao menuDao;
    @Autowired
    protected PermissionDao permissionDao;
    @Autowired
    protected RoleDao roleDao;
    @Autowired
    protected RoleMenuDao roleMenuDao;
    @Autowired
    protected RolePermissionDao rolePermissionDao;
    @Autowired
    protected UserDao userDao;
    @Autowired
    protected UserRoleDao userRoleDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<T> page = this.page(
                new Query<T>().getPage(params),
                new QueryWrapper<T>()
        );

        return new PageUtils(page);
    }
}
